/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.own.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import java.util.Date;
import java.util.List;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 种植信息Entity
 * @author F
 * @version 2019-09-27
 */
@Table(name="own_medicine_plant_information", alias="a", columns={
		@Column(name="id", attrName="id", label="唯一ID", isPK=true),
		@Column(name="batch_id", attrName="batchId", label="种植批次号"),
		@Column(name="variety_name", attrName="varietyName", label="植物名称", queryType=QueryType.LIKE),
		@Column(name="seed_source", attrName="seedSource", label="种子/幼体来源"),
		@Column(name="seed_weihgt", attrName="seedWeihgt", label="种子重量", comment="种子重量(g)"),
		@Column(name="plant_area", attrName="plantArea", label="种植区域", comment="种植区域(亩)"),
		@Column(name="plant_cycle", attrName="plantCycle", label="种植周期", comment="种植周期(月)"),
		@Column(name="area_code", attrName="areaCode", label="所属区域代码"),
		@Column(name="plant_time", attrName="plantTime", label="种植时间"),
		@Column(name="principal_name", attrName="principalName", label="负责人", queryType=QueryType.LIKE),
		@Column(name="address", attrName="address", label="详细地址"),
		@Column(name="output_name", attrName="outputName", label="产出物名称", queryType=QueryType.LIKE),
		@Column(name="pre_weight", attrName="preWeight", label="预产重量", comment="预产重量(kg)"),
		@Column(name="bm_batch_code", attrName="bmBatchCode", label="种植批次码"),
		@Column(name="harvest_status", attrName="harvestStatus", label="收获状态"),
		@Column(name="create_company", attrName="createCompany", label="所属企业标识", isUpdate=false, isQuery=false),
		@Column(name ="uuid", attrName ="uuid",label = "操作标识符"),
		@Column(name="txid", attrName ="txid",label = "返回的txid"),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.update_date DESC"
)
public class OwnMedicinePlantInformation extends DataEntity<OwnMedicinePlantInformation> {
	
	private static final long serialVersionUID = 1L;
	private String batchId;		// 种植批次号
	private String varietyName;		// 植物名称
	private String seedSource;		// 种子/幼体来源
	private Double seedWeihgt;		// 种子重量(g)
	private Double plantArea;		// 种植区域(亩)
	private Double plantCycle;		// 种植周期(月)
	private String areaCode;		// 所属区域代码
	private Date plantTime;		// 种植时间
	private String principalName;		// 负责人
	private String address;		// 详细地址
	private String outputName;		// 产出物名称
	private Double preWeight;		// 预产重量(kg)
	private String bmBatchCode;		// 种植批次码
	private String harvestStatus;  // 收获状态（0：种植中，1：已收获）
	private String createCompany;		// 所属企业标识
	private String uuid;		//索引本次操作的上下本标识
	private String txid;

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getTxid() {
		return txid;
	}

	public void setTxid(String txid) {
		this.txid = txid;
	}

	//非数据库字段
	private List<OwnMedicineGrowerInformation> ownMedicineGrowerInformationList;  //种植户信息
	//非数据库字段
	private List<OwnMedicineFieldManagement> ownMedicineFieldManagementList;  //田间管理信息
	//非数据库字段
	private List<OwnMedicineReceiptInformation> ownMedicineReceiptInformationList; //药材收获
	
	public OwnMedicinePlantInformation() {
		this(null);
	}

	public OwnMedicinePlantInformation(String id){
		super(id);
	}

	@NotBlank(message="种植批次号不能为空")
	@Length(min=0, max=25, message="种植批次号长度不能超过 25 个字符")
	public String getBatchId() {
		return batchId;
	}

	public void setBatchId(String batchId) {
		this.batchId = batchId;
	}
	
	@NotBlank(message="植物名称不能为空")
	@Length(min=0, max=50, message="植物名称长度不能超过 50 个字符")
	public String getVarietyName() {
		return varietyName;
	}

	public void setVarietyName(String varietyName) {
		this.varietyName = varietyName;
	}
	
	@NotBlank(message="种子/幼体来源不能为空")
	@Length(min=0, max=10, message="种子/幼体来源长度不能超过 10 个字符")
	public String getSeedSource() {
		return seedSource;
	}

	public void setSeedSource(String seedSource) {
		this.seedSource = seedSource;
	}

	@NotNull(message="种子重量不能为空")
	public Double getSeedWeihgt() {
		return seedWeihgt;
	}

	public void setSeedWeihgt(Double seedWeihgt) {
		this.seedWeihgt = seedWeihgt;
	}

	@NotNull(message="种植区域不能为空")
	public Double getPlantArea() {
		return plantArea;
	}

	public void setPlantArea(Double plantArea) {
		this.plantArea = plantArea;
	}
	
	public Double getPlantCycle() {
		return plantCycle;
	}

	public void setPlantCycle(Double plantCycle) {
		this.plantCycle = plantCycle;
	}

	@NotBlank(message="所属区域代码不能为空")
	@Length(min=0, max=50, message="所属区域代码长度不能超过 50 个字符")
	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	@NotNull(message="种植时间不能为空")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getPlantTime() {
		return plantTime;
	}

	public void setPlantTime(Date plantTime) {
		this.plantTime = plantTime;
	}

	@NotBlank(message="负责人不能为空")
	@Length(min=0, max=50, message="负责人长度不能超过 50 个字符")
	public String getPrincipalName() {
		return principalName;
	}

	public void setPrincipalName(String principalName) {
		this.principalName = principalName;
	}
	
	@Length(min=0, max=50, message="详细地址长度不能超过 50 个字符")
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	@Length(min=0, max=50, message="产出物名称长度不能超过 50 个字符")
	public String getOutputName() {
		return outputName;
	}

	public void setOutputName(String outputName) {
		this.outputName = outputName;
	}

	@NotNull(message="预产重量不能为空")
	public Double getPreWeight() {
		return preWeight;
	}

	public void setPreWeight(Double preWeight) {
		this.preWeight = preWeight;
	}
	
	@Length(min=0, max=50, message="种植批次码长度不能超过 50 个字符")
	public String getBmBatchCode() {
		return bmBatchCode;
	}

	public void setBmBatchCode(String bmBatchCode) {
		this.bmBatchCode = bmBatchCode;
	}
	
	@Length(min=0, max=64, message="所属企业标识长度不能超过 64 个字符")
	public String getCreateCompany() {
		return createCompany;
	}

	public void setCreateCompany(String createCompany) {
		this.createCompany = createCompany;
	}

	@Length(min=0, max=1, message="收获状态不能超过1个字符")
	public String getHarvestStatus() {
		return harvestStatus;
	}

	public void setHarvestStatus(String harvestStatus) {
		this.harvestStatus = harvestStatus;
	}

	public String[] getHarvestStatus_in() {
		return sqlMap.getWhere().getValue("harvest_status", QueryType.IN);
	}

	public void setHarvestStatus_in(String[] harvestStatus) {
		sqlMap.getWhere().and("harvest_status", QueryType.IN, harvestStatus);
	}

	public List<OwnMedicineGrowerInformation> getOwnMedicineGrowerInformationList() {
		return ownMedicineGrowerInformationList;
	}

	public void setOwnMedicineGrowerInformationList(List<OwnMedicineGrowerInformation> ownMedicineGrowerInformationList) {
		this.ownMedicineGrowerInformationList = ownMedicineGrowerInformationList;
	}

	public List<OwnMedicineFieldManagement> getOwnMedicineFieldManagementList() {
		return ownMedicineFieldManagementList;
	}

	public void setOwnMedicineFieldManagementList(List<OwnMedicineFieldManagement> ownMedicineFieldManagementList) {
		this.ownMedicineFieldManagementList = ownMedicineFieldManagementList;
	}

	public List<OwnMedicineReceiptInformation> getOwnMedicineReceiptInformationList() {
		return ownMedicineReceiptInformationList;
	}

	public void setOwnMedicineReceiptInformationList(List<OwnMedicineReceiptInformation> ownMedicineReceiptInformationList) {
		this.ownMedicineReceiptInformationList = ownMedicineReceiptInformationList;
	}
}